| Total Complexity | 2 | 
| Total Lines | 28 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | import { | 
            ||
| 17 | |||
| 18 | @Controller('quotes') | 
            ||
| 19 | @ApiUseTags('Billing') | 
            ||
| 20 | @ApiBearerAuth()  | 
            ||
| 21 | @UseGuards(AuthGuard('bearer')) | 
            ||
| 22 | export class CreateQuoteAction { | 
            ||
| 23 | constructor(  | 
            ||
| 24 |     @Inject('ICommandBus') | 
            ||
| 25 | private readonly commandBus: ICommandBus,  | 
            ||
| 26 |     @Inject('IQueryBus') | 
            ||
| 27 | private readonly queryBus: IQueryBus  | 
            ||
| 28 |   ) {} | 
            ||
| 29 | |||
| 30 | @Post()  | 
            ||
| 31 |   @ApiOperation({title: 'Create new quote'}) | 
            ||
| 32 | public async index(  | 
            ||
| 33 | @Body() quoteDTO: CreateQuoteDTO,  | 
            ||
| 34 | @LoggedUser() user: User  | 
            ||
| 35 |   ) { | 
            ||
| 36 |     try { | 
            ||
| 37 |       const {projectId, customerId, status} = quoteDTO; | 
            ||
| 38 | const id = await this.commandBus.execute(  | 
            ||
| 39 | new CreateQuoteCommand(user, status, customerId, projectId)  | 
            ||
| 40 | );  | 
            ||
| 41 | |||
| 42 | return id;  | 
            ||
| 43 |     } catch (e) { | 
            ||
| 44 | throw new BadRequestException(e.message);  | 
            ||
| 45 | }  | 
            ||
| 48 |